﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using posttracker.Classes;
namespace posttracker.Controls
{
    public partial class ControlDisplyingData : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void TextBox1_TextChanged(object sender, EventArgs e)
        {
            Loader load = new Loader();
            Product resp =  null;
            if (TextBox1.Text != "")
            {
                resp = load.getData(int.Parse(TextBox1.Text));
            }
            if (resp != null)
            {
                List<Product> done = new List<Product>();
                done.Add(resp);
                MyGrid.DataSource = done;

                MyGrid.DataBind();
            }
           
            /*
             * protected void UpdateBtn_Click(object sender, ImageClickEventArgs e)
        {
            MyShoppingCart usersShoppingCart = new MyShoppingCart();
            String cartId = usersShoppingCart.GetShoppingCartId();

            ShoppingCartUpdates[] cartUpdates = new ShoppingCartUpdates[MyList.Rows.Count];
            for (int i = 0; i < MyList.Rows.Count; i++)
            {
                IOrderedDictionary rowValues = new OrderedDictionary();
                rowValues = GetValues(MyList.Rows[i]);
                cartUpdates[i].ProductId =  Convert.ToInt32(rowValues["ProductID"]);
                cartUpdates[i].PurchaseQuantity = Convert.ToInt32(rowValues["Quantity"]); 

                CheckBox cbRemove = new CheckBox();
                cbRemove = (CheckBox)MyList.Rows[i].FindControl("Remove");
                cartUpdates[i].RemoveItem = cbRemove.Checked;
            }

            usersShoppingCart.UpdateShoppingCartDatabase(cartId, cartUpdates);
            MyList.DataBind();
            lblTotal.Text = String.Format("{0:c}", usersShoppingCart.GetTotal(cartId));
        }
             */

        }
    }
}